package com.slz3.business.module.templateExample.temStyle1.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.templateExample.temStyle1.domain.TemStyle1;
import com.slz3.business.module.templateExample.temStyle1.domain.TemStyle1Factory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class TemStyle1TransactionalServiceImpl implements TemStyle1TransactionalService {

    @Override
    public TemStyle1 modify(TemStyle1 temStyle1New) {
        Repositorys.temStyle1.test();
        Repositorys.temStyle1.save(TemStyle1Factory.initBaseFields());
        System.err.println(1/0);
        temStyle1New.setLastModifyTime(LocalDateTime.now());
        return Repositorys.temStyle1.saveAndFlush(temStyle1New);
    }

    @Override
    public List<TemStyle1> batchModify(List<TemStyle1> temStyle1List) {
        return Repositorys.temStyle1.saveAll(temStyle1List);
    }
}
